package com.nova.edc.dao.system.impl;

import com.nova.edc.dao.system.RoleDao;
import com.nova.edc.model.system.Role;
import com.nova.edc.model.system.SystemData;
import com.nova.frame.dao.buzz.JdbcBaseDAO;
import com.nova.frame.dao.criterion.Restrictions;

public class RoleDaoImpl extends JdbcBaseDAO<Role, String> implements RoleDao {

	@Override
	public Role getRoleByParent(int roleId) {
		return query().add(Restrictions.ne("RoleType", SystemData.ROLE_SYSTEM))
				.add(Restrictions.eq("ParentId", roleId)).get();
	}

	@Override
	public Role getCommonUser() {
		return query().add(Restrictions.eq("RoleType", SystemData.ROLE_USER))
				.get();
	}

}
